cmake_minimum_required(VERSION 3.16)
project(ReconstructionService)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找依赖包
find_package(OpenCV REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)

# 查找 nlohmann/json
find_package(nlohmann_json 3.2.0 REQUIRED)

# 查找 cpp-httplib
find_package(httplib REQUIRED)

# 包含目录
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/include)

# 源文件
set(SOURCES
    src/reconstruction_service.cpp
    src/frame_processor.cpp
    src/network_client.cpp
    src/main.cpp
)

# 头文件
set(HEADERS
    include/reconstruction_service.h
    include/frame_processor.h
    include/network_client.h
)

# 创建可执行文件
add_executable(reconstruction_service ${SOURCES} ${HEADERS})

# 链接库
target_link_libraries(reconstruction_service
    ${OpenCV_LIBS}
    nlohmann_json::nlohmann_json
    httplib::httplib
    Threads::Threads
)

# 编译选项
target_compile_options(reconstruction_service PRIVATE
    -O3
    -march=native
    -ffast-math
    -fopenmp
)

# 安装规则
install(TARGETS reconstruction_service
    RUNTIME DESTINATION bin
) 